home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Programming / CVS / source / amiga / amiga.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-04-29  |  7.4 KB  |  210 lines

  1. /*
  2.  * $Id$
  3.  *
  4.  * :ts=4
  5.  */
  6.  
  7. #ifndef _AMIGA_H
  8. #define _AMIGA_H 1
  9.  
  10. /****************************************************************************/
  11.  
  12. #include <stdio.h>
  13. #include <stdlib.h>
  14.  
  15. /****************************************************************************/
  16.  
  17. #include <stat.h>
  18.  
  19. #undef S_IFMT
  20. #undef S_IFDIR
  21. #undef S_IFREG
  22. #undef S_ISLNK
  23. #undef S_ISFIFO
  24. #undef S_ISDIR
  25. #undef S_ISREG
  26.  
  27.  
  28. /* first we undefine everything and then we redefine it */
  29. #undef S_ISUID
  30. #undef S_ISGID
  31. #undef S_ISVTX
  32.  
  33. #undef S_IRWXU
  34. #undef S_IRUSR
  35. #undef S_IWUSR
  36. #undef S_IXUSR
  37.  
  38. #undef S_IRWXG
  39. #undef S_IRGRP
  40. #undef S_IWGRP
  41. #undef S_IXGRP
  42.  
  43. #undef S_IRWXO
  44. #undef S_IROTH
  45. #undef S_IWOTH
  46. #undef S_IXOTH
  47.  
  48. #undef S_IFMT
  49. #undef S_IFIFO
  50. #undef S_IFDIR
  51. #undef S_IFBLK
  52. #undef S_IFREG
  53. #undef S_IFLNK
  54. #undef S_IFSOCK
  55.  
  56. /* redefining */
  57.  
  58. #define    S_ISUID    0004000        /* set user id on execution */
  59. #define    S_ISGID    0002000        /* set group id on execution */
  60. #define    S_ISVTX    0001000        /* save swapped text even after use */
  61.  
  62. #define    S_IRWXU    0000700        /* RWX mask for owner */
  63. #define    S_IRUSR    0000400        /* R for owner */
  64. #define    S_IWUSR    0000200        /* W for owner */
  65. #define    S_IXUSR    0000100        /* X for owner */
  66.  
  67. #define    S_IRWXG    0000070        /* RWX mask for group */
  68. #define    S_IRGRP    0000040        /* R for group */
  69. #define    S_IWGRP    0000020        /* W for group */
  70. #define    S_IXGRP    0000010        /* X for group */
  71.  
  72. #define    S_IRWXO    0000007        /* RWX mask for other */
  73. #define    S_IROTH    0000004        /* R for other */
  74. #define    S_IWOTH    0000002        /* W for other */
  75. #define    S_IXOTH    0000001        /* X for other */
  76.  
  77. #define    S_IFMT     0170000    /* type of file */
  78. #define    S_IFIFO     0010000    /* named pipe (fifo) */
  79. #define    S_IFDIR     0040000    /* directory */
  80. #define    S_IFBLK     0060000    /* block special */
  81. #define    S_IFREG     0100000    /* regular */
  82. #define    S_IFLNK     0120000    /* symbolic link */
  83. #define    S_IFSOCK 0140000    /* socket */
  84.  
  85. #define    S_ISDIR(m)    (((m) & S_IFMT) == S_IFDIR)    /* directory */
  86. #define    S_ISREG(m)    (((m) & S_IFMT) == S_IFREG)    /* regular file */
  87. #define    S_ISLNK(m)    (((m) & S_IFMT) == S_IFLNK)    /* symbolic link */
  88. #define    S_ISFIFO(m)    (((m) & S_IFMT) == S_IFIFO)    /* fifo */
  89.  
  90. /****************************************************************************/
  91.  
  92. unsigned long amiga_umask(unsigned long mask);
  93. int amiga_geteuid(void);
  94. int amiga_getuid(void);
  95. int amiga_getgid(void);
  96. long amiga_getgroups(long, long *);
  97. struct passwd * amiga_getpwuid(int uid);
  98. struct passwd * amiga_getpwnam(char *name);
  99. struct group * amiga_getgrnam(char *name);
  100. int amiga_gethostname(char * name,int namelen);
  101. int amiga_mkdir(const char *name,int mode);
  102. char * amiga_getlogin(void);
  103. int amiga_utime(const char * const name,const struct utimbuf * const time);
  104. int amiga_pclose(FILE * pipe);
  105. FILE * amiga_popen(const char * command, const char * mode);
  106. char * amiga_getpass(const char *prompt);
  107. unsigned amiga_sleep(unsigned seconds);
  108. int amiga_connect(int sockfd,struct sockaddr *name,int namelen);
  109. int amiga_dup(int sockfd);
  110. struct hostent * amiga_gethostbyname(char *name);
  111. struct servent * amiga_getservbyname(char *name,char *proto);
  112. int amiga_recv(int fd,void *buff,int nbytes,int flags);
  113. int amiga_send(int fd,const void * const buff,int nbytes,int flags);
  114. int amiga_shutdown(int fd,int how);
  115. int amiga_socket(int domain,int type,int protocol);
  116. char * amiga_strerror(int code);
  117. void * amiga_valloc(size_t bytes);
  118. int amiga_symlink(const char * const to,const char * const from);
  119. int amiga_readlink(const char * const path,char *buf,int buf_size);
  120. unsigned long amiga_waitpid(unsigned long pid,int *stat_loc,int options);
  121. long amiga_getpid(void);
  122. int amiga_piped_child(char ** argv,int * to_fd_ptr,int * from_fd_ptr);
  123. int amiga_isabsolute(const char * const filename);
  124. char * amiga_last_component(const char * const path);
  125. int amiga_unlink_file_dir(const char * const f);
  126. int amiga_fncmp(const char * const n1,const char * const n2);
  127. void amiga_fnfold(const char * const name);
  128. int amiga_fold_fn_char(int c);
  129. void amiga_expand_wild(int argc,const char ** const argv,int * _argc,char *** _argv);
  130. int amiga_access(const char *name, int modes);
  131. int amiga_chdir(const char *path);
  132. int amiga_creat(const char *name, int prot);
  133. FILE *amiga_fopen(const char *name, const char *modes);
  134. int amiga_fstat(int fd,struct stat * st);
  135. int amiga_lstat(const char *name, struct stat *st);
  136. int amiga_stat(const char *name, struct stat *st);
  137. int amiga_open(const char *name, int mode, int prot);
  138. void *amiga_opendir(const char *dir_name);
  139. int amiga_rename(const char *old, const char *new);
  140. int amiga_rmdir(const char *name);
  141. int amiga_unlink(const char *name);
  142. char * amiga_cvs_temp_name(void);
  143. int amiga_chmod(char *name,int mode);
  144. char *amiga_inet_ntoa(struct in_addr iaddr);
  145.  
  146. /****************************************************************************/
  147.  
  148. #ifndef NO_NAME_REPLACEMENT
  149. #undef creat
  150. #undef access
  151. #undef open
  152.  
  153. #define inet_ntoa(in_addr)            amiga_inet_ntoa(in_addr)
  154. #define chmod(name,mode)                amiga_chmod(name,mode)
  155. #define cvs_temp_name()                    amiga_cvs_temp_name()
  156. #define access(name, modes)                amiga_access(name, modes)
  157. #define chdir(path)                        amiga_chdir(path)
  158. #define creat(name, prot)                amiga_creat(name, prot)
  159. #define fopen(name, modes)                amiga_fopen(name, modes)
  160. #undef lstat
  161. #define lstat(name, st)                    amiga_lstat(name, st)
  162. #define stat(name, st)                    amiga_stat(name, st)
  163. #define open(name, mode, prot)            amiga_open(name, mode, prot)
  164. #define opendir(dir_name)                amiga_opendir(dir_name)
  165. #define rename(old, new)                amiga_rename(old, new)
  166. #define rmdir(name)                        amiga_rmdir(name)
  167. #define unlink(name)                    amiga_unlink(name)
  168. #define expand_wild(c,v,_c,_v)            amiga_expand_wild(c,v,_c,_v)
  169. #define isabsolute(filename)            amiga_isabsolute(filename)
  170. #define last_component(path)            amiga_last_component(path)
  171. #define unlink_file_dir(f)                amiga_unlink_file_dir(f)
  172. #define fncmp(n1,n2)                    amiga_fncmp(n1,n2)
  173. #define fnfold(name)                    amiga_fnfold(name)
  174. #define getpid()                        amiga_getpid()
  175. #define waitpid(pid,stat_loc,options)    amiga_waitpid(pid,stat_loc,options)
  176. #define readlink(path,buf,buf_size)        amiga_readlink(path,buf,buf_size)
  177. #define symlink(to,from)                amiga_symlink(to,from)
  178. #define valloc(bytes)                    amiga_valloc(bytes)
  179. #define sleep(seconds)                    amiga_sleep(seconds)
  180. #define getpass(prompt)                    amiga_getpass(prompt)
  181. #define pclose(pipe)                    amiga_pclose(pipe)
  182. #define popen(command, mode)            amiga_popen(command,mode)
  183. #define utime(name,time)                amiga_utime(name,time)
  184. #define strerror(code)                    amiga_strerror(code)
  185. #define umask(mask)                        amiga_umask(mask)
  186. #define geteuid()                        amiga_geteuid()
  187. #define getuid()                        amiga_getuid()
  188. #define getgid()                        amiga_getgid()
  189. #define getgroups(gidsetlen, gidset)        amiga_getgroups(gidsetlen, gidset)
  190. #define getpwuid(uid)                    amiga_getpwuid(uid)
  191. #define getpwnam(name)                    amiga_getpwnam(name)
  192. #define getgrnam(name)                    amiga_getgrnam(name)
  193. #define gethostname(name,namelen)        amiga_gethostname(name,namelen)
  194. #define mkdir(name,mode)                amiga_mkdir(name,mode)
  195. #define getlogin()                        amiga_getlogin()
  196. #define connect(sockfd,name,namelen)    amiga_connect(sockfd,name,namelen)
  197. #define dup(sockfd)                        amiga_dup(sockfd)
  198. #define gethostbyname(name)                amiga_gethostbyname(name)
  199. #define getservbyname(name,proto)        amiga_getservbyname(name,proto)
  200. #define recv(fd,buff,nbytes,flags)        amiga_recv(fd,buff,nbytes,flags)
  201. #define send(fd,buff,nbytes,flags)        amiga_send(fd,buff,nbytes,flags)
  202. #define shutdown(fd,how)                amiga_shutdown(fd,how)
  203. #define socket(domain,type,protocol)    amiga_socket(domain,type,protocol)
  204. #define fstat(fd,st)                    amiga_fstat(fd,st)
  205. #endif /* NO_NAME_REPLACEMENT */
  206.  
  207. /****************************************************************************/
  208.  
  209. #endif /* _AMIGA_H */
  210.